﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VipSys.SystemEntity;
using VipSys.DataLayer;

namespace VipSys.Business
{
    public class SubExamPlaceBLL
    {
        private static SubExamPlaceBLL m_Instance = null;
        /// <summary>
        /// 单实例
        /// </summary>
        public static SubExamPlaceBLL Instance
        {
            get
            {
                if (m_Instance == null)
                    m_Instance = new SubExamPlaceBLL();
                return m_Instance;
            }
        }
        /// <summary>
        /// 保存数据库中没有的考点信息
        /// </summary>
        /// <param name="szCityID"></param>
        /// <param name="szExamPlace"></param>
        /// <returns></returns>
        public short SaveExamPlace(string szCityID, string szExamPlace)
        {
            ExamPlace examPlace =new ExamPlace();
            short shRet = ExamPlaceAccess.Instance.GetExamPlace(szCityID, szExamPlace, ref examPlace);
            //考生提交的考点不存在于数据库
            if (shRet == SystemData.ReturnValue.RES_NO_FOUND)
            {
                examPlace.ParentID = szCityID;
                examPlace.PlaceName = szExamPlace;
                examPlace.PlaceType = SystemData.PlaceType.SCHOOL;
                examPlace.Description = string.Empty;
                shRet= ExamPlaceAccess.Instance.Add(examPlace);
                if (shRet != SystemData.ReturnValue.OK)
                    return shRet;
            }
            return SystemData.ReturnValue.OK;
        }
    }
}
